#!/usr/bin/env python
# -*- conding: utf-8 -*-

"""
@Time     : 2024/8/22 7:19
@Author   : liujingmao
@File     : Access_raw_response.py
"""
import dotenv
from openai import OpenAI

dotenv.load_dotenv()

client = OpenAI()
response = client.chat.completions.with_raw_response.create(
    messages=[{
        "role": "user",
        "content": "Say this is a test",
    }],
    model="gpt-4o-mini",
)
print(response.headers.get('x-request-id'))

# get the object that `chat.completions.create()` would have returned
completion = response.parse()
print(completion)
